﻿<Window x:Class="Microsoft.VisualStudio.TestTools.WorkItemMigrator.MessageBox"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:ClassModifier="internal"
        xmlns:WorkItemMigrator="clr-namespace:Microsoft.VisualStudio.TestTools.WorkItemMigrator"                    
        ResizeMode="NoResize"
        Title="Test Case Migrator Plus" 
        WindowStartupLocation="CenterOwner"
        SizeToContent="WidthAndHeight"     
        ShowInTaskbar="False"
        MinWidth="350"
        MaxHeight="600" 
        MaxWidth="400">
    <Window.Resources>
        <WorkItemMigrator:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />

        <Style x:Key="MessageIcon"
               TargetType="{x:Type Image}">
            <Setter Property="Height"
                    Value="32" />
            <Setter Property="Width"
                    Value="32" />
            <Setter Property="Margin"
                    Value="5,10,5,0" />
            <Setter Property="VerticalAlignment"
                    Value="Top" />
            <Setter Property="Source" 
                    Value="{DynamicResource ErrorIcon_32}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Category}"
                         Value="{x:Static WorkItemMigrator:MessageCategory.Warning}">
                    <Setter Property="Source" Value="{DynamicResource WarningIcon_32}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Category}"
                         Value="{x:Static WorkItemMigrator:MessageCategory.Information}">
                    <Setter Property="Source" Value="{DynamicResource InfoIcon_32}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>


        <Style x:Key="MessageDialogTitleStyle"
           TargetType="{x:Type TextBox}"
           BasedOn="{x:Null}">

            <Setter Property="BorderThickness"
                Value="0" />
            <Setter Property="Focusable"
                Value="True" />
            <Setter Property="FontSize"
                Value="16" />
            <Setter Property="Background"
                Value="Transparent" />
            <Setter Property="Foreground"
                Value="Black" />
            <Setter Property="HorizontalAlignment"
                Value="Left" />
            <Setter Property="Margin"
                Value="5,10,5,5" />
            <Setter Property="TextWrapping"
                Value="Wrap" />
            <Setter Property="VerticalAlignment"
                Value="Stretch" />
            <Setter Property="Width"
                Value="Auto" />

        </Style>

        <Style x:Key="MessageDialogTextStyle"
           TargetType="{x:Type TextBox}"
           BasedOn="{x:Null}">
            <Setter Property="BorderThickness"
                Value="0" />
            <Setter Property="Focusable"
                Value="True" />
            <Setter Property="FontSize"
                Value="12" />
            <Setter Property="Background"
                Value="Transparent" />
            <Setter Property="Foreground"
                Value="Black" />
            <Setter Property="Margin"
                Value="5,5,5,10" />
            <Setter Property="TextWrapping"
                Value="Wrap" />
            <Setter Property="Width"
                Value="Auto" />
        </Style>
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0"
              HorizontalAlignment="Stretch"
              VerticalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="45" />
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Image Style="{DynamicResource MessageIcon}"
                   x:Name="MessagePanelIcon"
                   Focusable="False"
                   Grid.Column="0"
                   Grid.RowSpan="3" />
            <TextBox x:Name="ProblemTextBlock"
                      AutomationProperties.AutomationId="MessageBox.ProblemTextBlock"
                      Grid.Column="1"
                      Grid.Row="0"
                      MaxWidth="350"
                      IsReadOnly="True"
                      Style="{DynamicResource MessageDialogTitleStyle}"
                      Text="{Binding Title}"
                      Visibility="{Binding Path=ProblemStatement, Converter={StaticResource StringToVisibilityConverter}}" />

            <TextBox x:Name="CauseTextBlock"
                 AutomationProperties.AutomationId="MessageBox.CauseTextBlock"
                 Grid.Column="1"
                 Grid.Row="1"
                 IsReadOnly="True"
                 IsTabStop="False"
                 VerticalScrollBarVisibility="Auto"
                 Style="{DynamicResource MessageDialogTextStyle}"
                 Text="{Binding LikelyCause}"
                 Visibility="{Binding Path=ProblemCause, Converter={StaticResource StringToVisibilityConverter}}">
            </TextBox>

            <TextBox x:Name="SolutionTextBlock"
                 AutomationProperties.AutomationId="MessageBox.SolutionTextBlock"
                 Grid.Column="1"
                 Grid.Row="2"
                 IsReadOnly="True"
                 IsTabStop="False"
                 Style="{DynamicResource MessageDialogTextStyle}"
                 Text="{Binding PotentialSolution}"
                 Visibility="{Binding Path=ProblemSolution, Converter={StaticResource StringToVisibilityConverter}}">
            </TextBox>
        </Grid>

        <Grid x:Name="ButtonBorder"
              Grid.Row="1"
              Background="Gray"
              Height="40">

            <StackPanel x:Name="ButtonPanel"
                        AutomationProperties.AutomationId="MessageBox.ButtonPanel"
                        HorizontalAlignment="Right"
                        Margin="3,5,3,5"
                        Orientation="Horizontal">

                <Button x:Uid="MessageBox_FirstButton"
                        x:Name="FirstButton"
                        AutomationProperties.AutomationId="MessageBox.FirstButton"
                        Style="{DynamicResource MessageBox_Button}"
                        Click="Button_Click"
                        Content="{Binding FirstButtonLabel}"
                        Visibility="{Binding FirstButtonLabel, Converter={StaticResource StringToVisibilityConverter}}" />

                <Button x:Uid="UserHostControl_SecondButton"
                        x:Name="SecondButton"
                        AutomationProperties.AutomationId="MessageBox.SecondButton"
                        Style="{DynamicResource MessageBox_Button}"
                        Click="Button_Click"
                        Content="{Binding SecondButtonLabel}"
                        Visibility="{Binding SecondButtonLabel, Converter={StaticResource StringToVisibilityConverter}}" />

                <Button x:Uid="UserHostControl_CloseButton"
                        x:Name="CloseButton"
                        AutomationProperties.AutomationId="MessageBox.CloseButton"
                        Style="{DynamicResource MessageBox_Button}"
                        Click="Button_Click"
                        IsCancel="True"
                        Content="{Binding Path=CancelButtonLabel}" />

            </StackPanel>
        </Grid>
    </Grid>
</Window>
